home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: July 16, 1997
- // Author: ajp
- //
- // Procedure Name:
- // AEreplaceNonNumericMulti
- //
- // Description Name;
- // Replaces the appropriate controls for a non-numeric multi
- //
- // Input Value:
- // node (name)
- //
- // Output Value:
- // None
- //
-
- global proc AEreplaceNonNumericMulti( string $frameName,
- string $nodeName,
- string $attributeName,
- string $changedCommand,
- string $attributeTypeProc,
- int $elementIndexString[])
- {
-
- global int $gMaxNonNumericMultis;
-
- string $plugName, $attrName, $controlName, $cmd;
-
- // build the changedCommand
- //
- string $cc = "\"\"";
- if ($changedCommand != "") {
- $cc = ("("+$changedCommand+" \""+$nodeName+"\")");
- }
-
- // The frame layout contains a single column layout.
- //
- string $children[] = `frameLayout -q -ca $frameName`;
- string $columnName = $children[0];
-
- setParent $columnName;
-
- // hide the column while we're modifying the controls inside it
- //
- columnLayout -e -vis false $columnName;
-
- // get the number of controls currently in the columnLayout
- //
- string $currentControls[] = `columnLayout -q -ca $columnName`;
- int $numCurrentControls = size($currentControls);
-
- // We don't display more than $gMaxNonNumericMultis items.
- // If there are 2 more than that, then
- // it is because we are displaying the "too big" message.
- // Delete it...
- //
- if ( $numCurrentControls == $gMaxNonNumericMultis + 2 ){
- deleteUI $currentControls[$gMaxNonNumericMultis]
- $currentControls[$gMaxNonNumericMultis+1];
- $numCurrentControls = $gMaxNonNumericMultis;
- }
-
- // get the number of controls needed by the new elements
- //
- int $numElements = size($elementIndexString);
-
- // if there are more than twenty elements, clip them.
- //
- int $tooBig = 0;
- if ( $numElements > $gMaxNonNumericMultis ){
- $tooBig = $numElements - $gMaxNonNumericMultis;
- $numElements = $gMaxNonNumericMultis;
- }
-
- // if we have more elements than we have controls, we'll
- // need to build more, otherwise we'll have to delete
- // the extra controls no longer needed
- //
- if ($numElements >= $numCurrentControls) {
-
- // reconnect the controls that we can
- //
- for ( $i = 0; $i < $numCurrentControls; $i++ ) {
- if ($elementIndexString[$i] == -1) continue;
- $controlName = $currentControls[$i];
- $plugName = ($nodeName+"."+$attributeName+"["+$elementIndexString[$i]+"]");
- $cmd = ($attributeTypeProc + " \""
- + $controlName + "\" \""
- + $plugName + "\" "
- + $cc);
- eval($cmd);
- }
-
- // and now create the extra controls that we need
- //
- string $newCommand = `substitute "replace" $attributeTypeProc "new"`;
- for ( $i = $numCurrentControls; $i < $numElements; $i++ ) {
- if ($elementIndexString[$i] == -1) continue;
- $plugName = ($nodeName+"."+$attributeName+"["+$elementIndexString[$i]+"]");
- $attrName = ($attributeName+"["+$elementIndexString[$i]+"]");
- $cmd = ($newCommand + " \""
- + $plugName + "\" \""
- + $attrName + "\" "
- + $cc);
- eval($cmd);
- }
-
- } else {
-
- // reconnect the controls that we can
- //
- for ( $i = 0; $i < $numElements; $i++ ) {
- if ($elementIndexString[$i] == -1) continue;
- $controlName = $currentControls[$i];
- $plugName = ($nodeName+"."+$attributeName+"["+$elementIndexString[$i]+"]");
- $cmd = ($attributeTypeProc + " \""
- + $controlName + "\" \""
- + $plugName + "\" "
- + $cc);
- eval($cmd);
- }
-
- // and delete the extra controls
- //
- for ( $i = $numElements; $i < $numCurrentControls; $i++ ) {
- deleteUI $currentControls[$i];
- }
-
- }
-
- // if there are elements that we cannot display, tell the user
- //
- if ( $tooBig > 0 ){
- text -l "There is insufficient room to display";
- text -l ("the remaining "+$tooBig+" array items");
- }
-
- columnLayout -e -vis true $columnName;
-
- }
-